LiveForm.options = {
    controlErrorClass: 'form-control-message',
    errorMessageClass: 'form-error-message',
    validMessageClass: 'form-valid-message',
    showValid: false,
    messageTag: 'span',
    messageIdPostfix: '_message'
};

$(function() {
    $('<div id="ajax-spinner"></div>').appendTo("body").hide();
    initButtons();
    initAjaxLinks();    
});

function initAjaxLinks() {    
    $("a.ajax").on("click", function(event) {
        event.preventDefault();
        $.get(this.href);

        $("#ajax-spinner").show().css({
            position: "absolute",
            left: event.pageX + 15,
            top: event.pageY + 15
        });
    });
}

function initButtons() {
    // TODO: init button jako funkce
    $(".button").button({});


    $(".button-add").button({
        icons: {
            primary: "ui-icon-plus"
        }
    });

    $(".action-icon-edit").button({
        icons: {
            primary: "ui-icon-pencil"
        },
        text: false
    });

    $(".action-icon-delete").button({
        icons: {
            primary: "ui-icon-trash"
        },
        text: false
    });
    $(".action-icon-plus").button({
        icons: {
            primary: "ui-icon-circle-plus"
        },
        text: false
    });
    $(".action-icon-minus").button({
        icons: {
            primary: "ui-icon-circle-minus"
        },
        text: false
    });
    $(".action-icon-image").button({
        icons: {
            primary: "ui-icon-image"
        },
        text: false
    });
    $(".action-icon-note").button({
        icons: {
            primary: "ui-icon-note"
        },
        text: false
    });
    $(".action-icon-publish").button({
        icons: {
            primary: "ui-icon-circle-check"
        },
        text: false
    });
    $(".action-icon-unpublish").button({
        icons: {
            primary: "ui-icon-circle-close"
        },
        text: false
    });
}


